<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Annotation filter form base class.
 *
 * @package    FinalsClub
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 13459 2008-11-28 14:48:12Z fabien $
 */
class BaseAnnotationFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'user_id'         => new sfWidgetFormPropelChoice(array('model' => 'User', 'add_empty' => true)),
      'annotate_type'   => new sfWidgetFormFilterInput(),
      'annotate_state'  => new sfWidgetFormFilterInput(),
      'annotate_date'   => new sfWidgetFormFilterInput(),
      'annotate_code'   => new sfWidgetFormFilterInput(),
      'annotate_gid'    => new sfWidgetFormFilterInput(),
      'annotate_match'  => new sfWidgetFormFilterInput(),
      'source_type'     => new sfWidgetFormFilterInput(),
      'type'            => new sfWidgetFormFilterInput(),
      'html_url'        => new sfWidgetFormFilterInput(),
      'file_id'         => new sfWidgetFormPropelChoice(array('model' => 'File', 'add_empty' => true)),
      'note_id'         => new sfWidgetFormPropelChoice(array('model' => 'Note', 'add_empty' => true)),
      'book_section_id' => new sfWidgetFormPropelChoice(array('model' => 'Section', 'add_empty' => true)),
      'text'            => new sfWidgetFormFilterInput(),
      'link_to'         => new sfWidgetFormFilterInput(),
      'link_title'      => new sfWidgetFormFilterInput(),
      'tags'            => new sfWidgetFormFilterInput(),
      'context'         => new sfWidgetFormFilterInput(),
      'color'           => new sfWidgetFormFilterInput(),
      'subject'         => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'user_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'User', 'column' => 'id')),
      'annotate_type'   => new sfValidatorPass(array('required' => false)),
      'annotate_state'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'annotate_date'   => new sfValidatorPass(array('required' => false)),
      'annotate_code'   => new sfValidatorPass(array('required' => false)),
      'annotate_gid'    => new sfValidatorPass(array('required' => false)),
      'annotate_match'  => new sfValidatorPass(array('required' => false)),
      'source_type'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'type'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'html_url'        => new sfValidatorPass(array('required' => false)),
      'file_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'File', 'column' => 'id')),
      'note_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Note', 'column' => 'id')),
      'book_section_id' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Section', 'column' => 'id')),
      'text'            => new sfValidatorPass(array('required' => false)),
      'link_to'         => new sfValidatorPass(array('required' => false)),
      'link_title'      => new sfValidatorPass(array('required' => false)),
      'tags'            => new sfValidatorPass(array('required' => false)),
      'context'         => new sfValidatorPass(array('required' => false)),
      'color'           => new sfValidatorPass(array('required' => false)),
      'subject'         => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('annotation_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Annotation';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'created_at'      => 'Date',
      'user_id'         => 'ForeignKey',
      'annotate_type'   => 'Text',
      'annotate_state'  => 'Number',
      'annotate_date'   => 'Text',
      'annotate_code'   => 'Text',
      'annotate_gid'    => 'Text',
      'annotate_match'  => 'Text',
      'source_type'     => 'Number',
      'type'            => 'Number',
      'html_url'        => 'Text',
      'file_id'         => 'ForeignKey',
      'note_id'         => 'ForeignKey',
      'book_section_id' => 'ForeignKey',
      'text'            => 'Text',
      'link_to'         => 'Text',
      'link_title'      => 'Text',
      'tags'            => 'Text',
      'context'         => 'Text',
      'color'           => 'Text',
      'subject'         => 'Text',
    );
  }
}
